/**
 *
 */
package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.AppVersionMapper;
import com.ybkj.daijia.server.model.AppVersion;
import com.ybkj.daijia.server.model.AppVersion.AppVersionType;
import com.ybkj.daijia.server.service.AppVersionService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Shine
 *
 */
@Service
public class DefaultAppVersionService implements AppVersionService {

    @Autowired
    private AppVersionMapper appVersionMapper;


    /* (non-Javadoc)
     * @see com.ybkj.shop.service.AdminService#queryAll()
     */
    public List<AppVersion> queryAll() {

        return appVersionMapper.selectAll();
    }

    @Transactional(rollbackFor = Exception.class)
    public AppVersion insertRecord(AppVersion appVersion) {
        //???插入版本目前没有
        appVersionMapper.insertRecord(appVersion);

        return appVersion;

    }

    public AppVersion findOne(Long id) {

        return appVersionMapper.selectByPrimaryKey(id);
    }


    @Transactional(rollbackFor = Exception.class)
    public void delete(AppVersion appVersion) {

        appVersionMapper.deleteByPrimaryKey(appVersion.getId());

    }

    @Override
    public AppVersion findByAppVersionType(AppVersionType appVersionType) {

        return appVersionMapper.selectByAppVersionType(appVersionType);

    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateByPrimaryKey(AppVersion record) {

        return appVersionMapper.updateByPrimaryKey(record);
    }


}